<!DOCTYPE html>
<html>

  <head>
    <meta charset='utf-8'>
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <meta name="description" content="AndroidSVG : SVG rendering library for Android">

    <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
    <link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
    <link rel="stylesheet" type="text/css" href="stylesheets/prettify-eclipse.css">

    <title>AndroidSVG</title>
  </head>

  <body>

    <!-- HEADER -->
    <div id="header_wrap" class="outer">
      <header class="inner">
        <a id="forkme_banner" href="https://github.com/BigBadaboom/androidsvg">View on GitHub</a>

        <a href="index.html"><img id="project_logo" src="images/AndroidSVG_logo.svg" title="AndroidSVG logo"/></a>
        <h1 id="project_title">AndroidSVG</h1>
        <h2 id="project_tagline">SVG rendering library for Android</h2>

        <!--
        <section id="downloads">
          <a class="zip_download_link" href="https://github.com/BigBadaboom/androidsvg/zipball/master">Download this project as a .zip file</a>
          <a class="tar_download_link" href="https://github.com/BigBadaboom/androidsvg/tarball/master">Download this project as a tar.gz file</a>
        </section>
        -->
      </header>
    </div>

    <!-- MAIN CONTENT -->
    <div id="main_content_wrap" class="outer">
      <div class="inner">
        <nav>
          <ul>
            <li><a href="download.html">Download</a></li>
            <li><a href="release_notes.html">Release Notes</a></li>
            <li><a href="https://bigbadaboom.github.io/androidsvg/doc/index.html">Javadoc</a></li>
            <li><a href="documentation.html">Documentation</a></li>
            <li><a href="svg_implementation_details.html">SVG Implementation</a></li>
            <li><a href="faq.html">FAQ</a></li>
            <li><a href="known_issues.html">Known Issues</a></li>
            <li><a href="report_bugs.html">Report a bug</a></li>
            <li><a href="mailto:androidsvgfeedback@gmail.com">Contact the author</a></li>
          </ul>

          <p><em>License:<br/><a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License v2.0</a></em></p>

          <p><a href="https://twitter.com/AndroidSVG"><img src="images/twitter.png"></a></p>
        </nav>
        <section id="main_content">

        <h1><a id="androidsvg" class="anchor" href="#androidsvg" aria-hidden="true"><span class="octicon octicon-link"></span></a>AndroidSVG</h1>




<p>AndroidSVG is a SVG parser and renderer for Android.  It has almost complete support for the static
visual elements of the SVG 1.1 and SVG 1.2 Tiny specifications (except for filters).  AndroidSVG
correctly renders the <a href="http://www.codedread.com/acid/acid1.html">SVG Acid Test</a>.</p>

<p><em>AndroidSVG is licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License v2.0</a></em>.</p>

<h2>
<a id="downloads" class="anchor" href="#downloads" aria-hidden="true"><span class="octicon octicon-link"></span></a>Where to get it</h2>

<p>The current release is version <strong>1.4</strong>.</p>

<p>See the <a href="release_notes.html">1.4 release notes</a> for all the new features and bug fixes in this release.</p>


<h3>To use AndroidSVG in your app</h3>

<p>If you haven't already, remember to add Maven Central to the repository list in you main/root <code>build.gradle</code> file.</p>

<pre class="prettyprint">
    repositories {
        google()
        jcenter()
        <span class="highlight">mavenCentral()</span>
    }
</pre>

<p>Then in your app module <code>build.gradle</code> file, add:</p>

<pre class="prettyprint">
    implementation 'com.caverock:androidsvg-aar:1.4'
</pre>

<p>Direct links to the v1.4 AAR and JAR files, and to older versions, are available on the <a href="download.html">Download page</a>.</p>


<h2>
<a id="sampleapp" class="anchor" href="#downloads" aria-hidden="true"><span class="octicon octicon-link"></span></a>Sample App</h2>

<p>For examples of how to use the library in a real world app, check out our <a href="https://github.com/BigBadaboom/androidsvgsampleapp">AndroidSVG Sample App</a></p>

<p>
  <a href='https://play.google.com/store/apps/details?id=com.caverock.androidsvgsample&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' width="200" src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png'/></a>
</p>


<h2>
<a id="editor-support" class="anchor" href="#editor-support" aria-hidden="true"><span class="octicon octicon-link"></span></a>Editor support</h2>

<p>A design goal of this project is to correctly render SVG files that have been exported from the
most popular vector editors. AndroidSVG has been tested with files generated by Adobe Illustrator,
Sketch, Inkscape, Xara, Corel Draw, and many others.</p>

<p>
<img src="images/svg_acid_test.png" alt="SVG Acid Test">
</p>
<p>
<img src="images/xara_blue_car.png" alt="Xara Blue car">
</p>

<h2>
<a id="api-introduction" class="anchor" href="#api-introduction" aria-hidden="true"><span class="octicon octicon-link"></span></a>API Introduction</h2>

<p>All interaction with AndroidSVG is via the <code>SVG</code> class.</p>

<p>Typically, you will call one of the SVG loading and parsing classes then call the renderer, passing it a canvas to draw upon.</p>

<ul>
<li>Use one of the static <code>SVG.getFromX()</code> methods to read and parse the SVG file.  They will return an instance
of the <code>SVG</code> class.</li>
<li>Then to render, you can either call <code>renderToPicture()</code> to get an Android <code>Picture</code> instance, or call
<code>renderToCanvas()</code> to render directly to a Canvas.</li>
</ul>

<p>For more information, see the <a href="documentation.html">Documentation</a> or
read the <a href="doc/reference/com/caverock/androidsvg/package-summary.html">Javadoc</a>.</p>

<h2>
<a id="usage-example" class="anchor" href="#usage-example" aria-hidden="true"><span class="octicon octicon-link"></span></a>Usage example</h2>

<p><a href="https://bitbucket.org/paullebeau/androidsvg/downloads">Download the latest version</a> and copy it to your <code>libs</code> folder
in Eclipse.  Then in your app, you can do something like the following.</p>

<pre class="prettyprint">
// Read an SVG from the assets folder
SVG  svg = SVG.getFromAsset(getContext().getAssets(), filename);

// Create a canvas to draw onto
if (svg.getDocumentWidth() != -1) {
   Bitmap  newBM = Bitmap.createBitmap((int) Math.ceil(svg.getDocumentWidth()),
                                       (int) Math.ceil(svg.getDocumentHeight()),
                                       Bitmap.Config.ARGB_8888);
   Canvas  bmcanvas = new Canvas(newBM);

   // Clear background to white
   bmcanvas.drawRGB(255, 255, 255);

   // Render our document onto our canvas
   svg.renderToCanvas(bmcanvas);
}
</pre>

<p>If you just want to use an SVG icon in your layout, you can use the supplied
<a href="SVGImageView.html">SVGImageView</a> custom view class.</p>

<h2>
<a id="what-features-of-svg-are-supported" class="anchor" href="#what-features-of-svg-are-supported" aria-hidden="true"><span class="octicon octicon-link"></span></a>What features of SVG are supported?</h2>

<p>AndroidSVG supports the following SVG elements:</p>

<h3>
<a id="fully-supported" class="anchor" href="#fully-supported" aria-hidden="true"><span class="octicon octicon-link"></span></a>Fully supported</h3>

<p><code>&lt;circle&gt;</code> <code>&lt;clipPath&gt;</code> <code>&lt;defs&gt;</code> <code>&lt;desc&gt;</code> <code>&lt;ellipse&gt;</code> <code>&lt;g&gt;</code>
   <code>&lt;line&gt;</code> <code>&lt;linearGradient&gt;</code> <code>&lt;marker&gt;</code> <code>&lt;mask&gt;</code> <code>&lt;path&gt;</code> <code>&lt;pattern&gt;</code> <code>&lt;polygon&gt;</code>
  <code>&lt;polyline&gt;</code> <code>&lt;rect&gt;</code> <code>&lt;solidColor&gt;</code> <code>&lt;stop&gt;</code> <code>&lt;svg&gt;</code> <code>&lt;switch&gt;</code> <code>&lt;symbol&gt;</code>
  <code>&lt;title&gt;</code> <code>&lt;use&gt;</code> <code>&lt;view&gt;</code></p>

<h3>
<a id="supported-with-some-limitations" class="anchor" href="#supported-with-some-limitations" aria-hidden="true"><span class="octicon octicon-link"></span></a>Supported with some limitations</h3>

<dl>
  <dt><code>&lt;image&gt;</code></dt>
  <dd>Loading of external <em>SVG</em> files is not supported.</dd>

  <dt><code>&lt;text&gt;</code></dt>
  <dd>The multi-value forms of <code>x</code>, <code>y</code>, <code>dx</code>, and <code>dy</code> are not supported. Some of the other text features, such as <code>alignment-baseline</code> etc, are not supported.</dd>

  <dt><code>&lt;textPath&gt;</code></dt>
  <dd>Same restrictions as <code>&lt;text&gt;</code></dd>

  <dt><code>&lt;tref&gt;</code></dt>
  <dd>Same restrictions as <code>&lt;text&gt;</code>. Also, external <code>href</code> references are not supported.</dd>

  <dt><code>&lt;tspan&gt;</code></dt>
  <dd>Same restrictions as <code>&lt;text&gt;</code></dd>

  <dt><code>&lt;pattern&gt;</code></dt>
  <dd>Patterned strokes are not currently supported.</dd>
  <dd></dd>

  <dt><code>&lt;radialGradient&gt;</code></dt>
  <dd>The <code>fx</code> and <code>fy</code> attributes are not currently supported, due to a limitation of the Android <code>Canvas</code> class.</dd>

  <dt><code>&lt;style&gt;</code></dt>
  <dd>We use a simplified CSS parser that supports most, but not all, of the latest CSS standard.</dd>
</dl>

<h3>
<a id="not-supported-at-all" class="anchor" href="#not-supported-at-all" aria-hidden="true"><span class="octicon octicon-link"></span></a>Not supported at all</h3>

<ul>
<li>SMIL and CSS animation is not supported.</li>
<li>Filter Effects via <code>&lt;filter&gt;</code> are not supported.</li>
<li><code>&lt;foreignObject&gt;</code> is not supported.</li>
</ul>

<p>For more information on what elements, attributes and properties are supported, see the
<a href="svg_implementation_details.html">SVG Implementation Details</a> page.</p>

<h3>
<a id="find-a-bug" class="anchor" href="#find-a-bug" aria-hidden="true"><span class="octicon octicon-link"></span></a>Find a bug?</h3>

<p>Please file an <a href="report_bugs.html">bug report</a> and include as much detail as you can.
If possible, please include a sample SVG file showing the error.</p>

<p>If you wish to contact the author with feedback on this project, you can email me at
<a href="mailto:androidsvgfeedback@gmail.com">androidsvgfeedback@gmail.com</a>.</p>

<p>If you have found AndroidSVG useful and use it in your project, please let me know. I'd love to hear about it!</p>




        </section>
      </div>
    </div>

    <!-- FOOTER  -->
    <div id="footer_wrap" class="outer">
      <footer class="inner">
        <p class="copyright">AndroidSVG maintained by <a href="https://github.com/BigBadaboom">Paul LeBeau</a></p>
        <p>Published with <a href="https://pages.github.com">GitHub Pages</a></p>
      </footer>
    </div>

    

  </body>
</html>
